<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>title</title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../css/iconfont.css"/>
		<link rel="stylesheet" type="text/css" href="../css/doms.css"/>

</head>
<body>
  <div class="br"></div>
  <section class="aui-content">

      <ul class="aui-list aui-list-in">
				<li class="aui-list-item">
						<div class="aui-list-item-label-icon">
								<i class="aui-iconfont aui-icon-cert aui-text-warning"></i>
						</div>
						<div class="aui-list-item-inner">
								<div class="aui-list-item-title">用户名</div>
								<label id="nictxt" style="display:none;width: 165px;"></label>
								<input type="text" id="nickname"  style=" width: 165px;margin-right:15px;height: 35px;" placeholder=" 用户名!" readonly="true"/>
								
								<div id="vsionnc" class="aui-list-item-right"></div>
						</div>
				</li>
				<li class="aui-list-item">
						<div class="aui-list-item-label-icon">
								<i class="aui-iconfont aui-icon-cert aui-text-warning"></i>
						</div>
						<div class="aui-list-item-inner">
								<div class="aui-list-item-title">密码</div>
								<label id="zfbtxt" style="display:none;width: 165px;"></label>
								<input type="text" id="zfb"  style=" width: 165px;border: 1px solid #ccc;margin-right:15px;height: 35px;" placeholder=" 你的密码" />
								<input type="button" id="btnzfb" class="button white" tapmode onclick="zfbcz()" value="修改"/>
								<div id="vsionzfb" class="aui-list-item-right"></div>
						</div>
				</li>
		





      </ul>
      <!-- <div id="otbtn" class="aui-content-padded" tapmode onclick="exitLogin()"> -->
          <!-- <div class="aui-btn-tuichu aui-btn-block">退出登录</div> -->
      <!-- </div> -->
  </section>
</body>
<script src="../js/hui.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="../script/api.js" ></script>
<script type="text/javascript">
  var api_url = localStorage.getItem('api_url');
	var smsVerify = null;
    apiready = function(){ 
			$api.byId('nickname').value=localStorage.getItem('user_name');
			$api.byId('zfb').value=localStorage.getItem('mim');
  }
  
	
	function niccz(){
		
		var btnncxg = $api.val($api.byId('btnnc'));
		var btnnc = $api.byId('btnnc');
		 
		var nicknamex = $api.val($api.byId('nickname'));
	 if(nicknamex == ''){
	 	api.alert({
	 			title: '亲爱的!~',
	 			msg: '昵称不能为空哦',
	 	});
	 	return;
	 }
	 
	 api.ajax({
	 		url: api_url+'/App/Index/dizhi.html',
	 		method: 'get',
	 		data: {
	 				values: {
	 						uid: localStorage.getItem('user_id'),
							nickname: nicknamex
	 				}
	 		}
	 },function(ret, err){
	// alert(ret)
	 		if (ret) {
				if (ret.code == 1) {
	 					 localStorage.setItem('dizhi',ret.msg['dizhi']);
						 //alert(ret.msg['dizhi'])
	 				alert('修改成功');

	 	}else if (ret.code == 0) {
	 			  api.hideProgress();
	 				alert('修改失败');
	 		    }
	 	else {
	 			api.hideProgress();
	 			alert('网络错误！11');
	 		  }
			 }
		});
	}


function zfbcz(){
		var btnzfbxg = $api.val($api.byId('btnzfb'));
		var btnzfb = $api.byId('btnzfb');
		
		var zfbx = $api.val($api.byId('zfb'));
		if(zfbx == ''){
		api.alert({
				title: '亲爱的!~',
				msg: '不能为空哦',
		});
		return;
		}
		api.ajax({
			url: api_url+'/App/Index/zhifubao.html',
			method: 'get',
			data: {
					values: {
							uid: localStorage.getItem('user_id'),
							zhi: zfbx
					}
			}  
		},function(ret, err){
		//alert(ret)
			if (ret) {
				if (ret.code == 1) {
			localStorage.setItem('mim',ret.msg);
			
					alert('修改成功');

		}else if (ret.code == 0) {
					api.hideProgress();
					alert('修改失败');
					}
		else {
				api.hideProgress();
				alert('网络错误！11');
				}
				}
		});
	}


  //退出登录
  function exitLogin(){
    api.sendEvent({
      name: 'newLoingdata',
      extra: {
      }
    });
    api.showProgress({
        title: '稍后...',
        text: '正在退出...',
        modal: false
    });
    localStorage.setItem('user_id','');
    localStorage.setItem('user_name','');
    localStorage.setItem('viptime','');
		localStorage.clear();

    api.toast({
        msg: '请重新登陆'
    });
    api.closeWin({
    });
   localStorage.clear();
  }


 
</script>
</html>
